#!/usr/bin/env node

const koa = require('koa'),
      task = require('./lib/task.js');
      log = console.log;

const app = new koa();
app.use(async (ctx,next)=>{
  const start = Date.now();
  next();
  const end = Date.now();
  ctx.cont = end-start;
  log(`${ctx.method}${ctx.path}${end-start}`);

});

app.use(async (ctx,next)=>{//M-hello
  ctx.body='hello koa'+await task()+'res';
});
app.listen(8080);
